/**
* <p>Title: Note.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2013</p>
* @author majintao
* @date 2013-1-30
* @version 1.0
*/
package entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "t_note")
public class Note {
	private Integer id;
	private String title;
	private String content;
	private String label;
	private String summary;
	private Date createTime;
	private Dir dir;	
	private User user;
	
	
	public Note() {}
	public Note(Integer id, String title,Date createTime, String summary, String label) {
		super();
		this.id = id;
		this.title = title;
		this.label = label;
		this.summary = summary;
		this.createTime = createTime;
	}
	@Id
    @GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "title")
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	//@Basic(fetch = FetchType.LAZY) //设置为延迟加载，当我们在数据库中取这条记录的时候，不会去取这个字段
	@Column(name = "content")
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@Column(name = "label")
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	@Column(name = "summary")
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	@Temporal(TemporalType.DATE)
	@Column(name = "createTime")
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@ManyToOne()
	@JoinColumn(name="dir_id")
	public Dir getDir() {
		return dir;
	}
	public void setDir(Dir dir) {
		this.dir = dir;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

}
